<!DOCTYPE html>

<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>EppiStor</title>
  <link rel="stylesheet" href="/css/main.css" />
  <link rel="shortcut icon" href="/favicon.ico" />
</head>
<body>
</body>
  <h1>{% if vial.key.id() is none %}New Vial{% else %}Update Vial {{ vial.name }}{% endif %}</h1>

  <form id="vial_form" action="/vial" method="POST">
    <label for="name">Name</label>
    <input id="name" type="text" name="name" value="{{ vial.name }}" maxlength="100"/>
    <br />

    <label for="description">Description</label>
    <textarea id="description" name="description">{{ vial.description }}</textarea>
    <br />

    <label for="creation_date">Date</label>
    <input id="creation_date" type="text" name="creation_date" value="{{ vial.creation_date }}" maxlength="100"/>
    <br />

    <label for="group">Group</label>
    <select id="group" name="group_key">
      {% for group in vial_groups %}
      <option value="{{ group.key.urlsafe() }}"{% if group.key == vial.group %} selected="selected"{% endif %}>{{ group.name }}</option>
      {% endfor %}
    </select>
    <a href="/vial_group">Create New Group</a>
    {% if vial.group is not none %}
    <a href="/vial_group?key={{ vial.group.urlsafe() }}">Update Group</a>
    {% endif %}
    <br />

    {% if vial.key.id() is none %}
    <input type="hidden" name="x" value="{{ vial.x }}" />
    <input type="hidden" name="y" value="{{ vial.y }}" />
    <input type="hidden" name="container_key" value="{{ vial.key.parent().urlsafe() }}" />
    <input type="submit" value="Create" />
    {% else %}
    <input type="hidden" name="key" value="{{ vial.key.urlsafe() }}" />
    <input type="submit" value="Update" />
    {% endif %}
  </form>

  <a href="/container?key={{ vial.key.parent().urlsafe() }}">Back</a>
</html>

